/*
 * @Description:
 * @Author: wlj
 * @Date: 2023-01-03 14:47:46
 * @LastEditors: wlj
 * @LastEditTime: 2023-01-03 19:17:58
 * @FilePath: \my-vite-app\src\utils\axios.ts
 */
import instance from "./request";
const axios = async ({ method, url, data, config }: any): Promise<any> => {
  const lMethos = method.toLowerCase();
  switch (lMethos) {
    case "post":
      return instance.post(url, data, { ...config });
    case "get":
      return instance.get(url, {
        params: data,
        ...config,
      });
    case "delete":
      return instance.delete(url, {
        params: data,
        ...config,
      });
    case "put":
      return instance.put(url, data, { ...config });
    default:
      console.error(`未知的method${method}`);
      return false;
  }
};
export default axios;
